package com.seven.system.controller.api;

import com.seven.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author longlong
 * @date 2024/3/7 17:09
 * description
 */
@RestController
@RequestMapping("/system/logout")
public class LogoutController {
    @Autowired
    private StringRedisTemplate redisTemplate;

    @PostMapping
    public Result logout(HttpServletRequest request){
        String token = request.getHeader("token");
        redisTemplate.delete(token);
        return new Result(2000,"退出成功",null);
    }
}
